<template>
  <div class="setting">
    <template v-if="tabType == 'data'">
      <div class="card">
        <div class="title">富文本样式</div>
        <div class="content">
          <el-form-item label="富文本">
            <el-input v-model="settingData.data.title">
              <template #append>
                <span class="cursor-pointer" @click="onSelect">选择</span>
              </template>
            </el-input>
          </el-form-item>
        </div>
      </div>
    </template>
  </div>
</template>

<script setup>
  import { useModal } from '@/sheep/hooks';
  import RichtextSelect from '@/app/shop/admin/data/richtext/select.vue';
  const props = defineProps(['settingData', 'tabType']);

  function onSelect() {
    useModal(
      RichtextSelect,
      {
        title: '选择富文本',
      },
      {
        confirm: (res) => {
          props.settingData.data.id = res.data.id;
          props.settingData.data.title = res.data.title;
          props.settingData.data.richtext = res.data;
        },
      },
    );
  }
</script>
